home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / misc / o-z / x-windows / mesa-amiwin / include / gl / glu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-03  |  11.5 KB  |  413 lines

  1. /* glu.h */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  1.2
  6.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25. $Id: glu.h,v 1.15 1995/08/03 22:00:57 brianp Exp $
  26.  
  27. $Log: glu.h,v $
  28.  * Revision 1.15  1995/08/03  22:00:57  brianp
  29.  * explictly assigned values to GLU_ symbols to match OpenGL
  30.  *
  31.  * Revision 1.14  1995/08/03  19:35:29  brianp
  32.  * replaced all GLUenum with GLenum
  33.  *
  34.  * Revision 1.13  1995/07/28  15:00:44  brianp
  35.  * added comments for each NURBS error code
  36.  * fixed a couple prototypes
  37.  *
  38.  * Revision 1.12  1995/07/18  20:22:15  brianp
  39.  * added GLU_INCOMPATIBLE_GL_VERSION
  40.  * start GLUenum values at 10000
  41.  *
  42.  * Revision 1.11  1995/05/30  13:13:03  brianp
  43.  * added GLU_TRUE, GLU_FALSE, GLU_NURBS_ERRORxx, etc.
  44.  *
  45.  * Revision 1.10  1995/05/29  20:08:38  brianp
  46.  * added gluGetNurbsProperty() prototype
  47.  *
  48.  * Revision 1.9  1995/05/24  13:43:30  brianp
  49.  * added gluBeginTrim, gluEndTrim, gluPwlCurve
  50.  *
  51.  * Revision 1.8  1995/05/22  17:03:21  brianp
  52.  * Release 1.2
  53.  *
  54.  * Revision 1.7  1995/05/16  18:03:22  brianp
  55.  * renamed GLU_EDGEFLAG to GLU_EDGE_FLAG
  56.  * renamed quadric, triangulator and nurbs structs
  57.  *
  58.  * Revision 1.6  1995/04/28  20:04:57  brianp
  59.  * added stuff for Bogdan Sikorski's polygon tesselator
  60.  *
  61.  * Revision 1.5  1995/04/28  14:50:50  brianp
  62.  * moved structs to their respective .c files
  63.  *
  64.  * Revision 1.4  1995/04/18  15:50:19  brianp
  65.  * changed GLenum arguments to GLUenum, added ErrorFunc to quadric object
  66.  *
  67.  * Revision 1.3  1995/04/17  14:41:26  brianp
  68.  * added GLU version 1.1 function: gluGetString
  69.  *
  70.  * Revision 1.2  1995/03/04  19:45:47  brianp
  71.  * 1.1 beta revision
  72.  *
  73.  * Revision 1.1  1995/02/28  21:21:03  brianp
  74.  * Initial revision
  75.  *
  76.  */
  77.  
  78.  
  79. #ifndef GLU_H
  80. #define GLU_H
  81.  
  82.  
  83. #ifdef __cplusplus
  84. extern "C" {
  85. #endif
  86.  
  87.  
  88. #include "GL/gl.h"
  89.  
  90.  
  91. #define GLU_VERSION_1_1        1
  92.  
  93.  
  94. #define GLU_TRUE   GL_TRUE
  95. #define GLU_FALSE  GL_FALSE
  96.  
  97.  
  98. enum {
  99.     /* Normal vectors */
  100.     GLU_SMOOTH    = 100000,
  101.     GLU_FLAT    = 100001,
  102.     GLU_NONE    = 100002,
  103.  
  104.     /* Quadric draw styles */
  105.     GLU_POINT    = 100010,
  106.     GLU_LINE    = 100011,
  107.     GLU_FILL    = 100012,
  108.     GLU_SILHOUETTE    = 100013,
  109.  
  110.     /* Quadric orientation */
  111.     GLU_OUTSIDE    = 100020,
  112.     GLU_INSIDE    = 100021,
  113.  
  114.     /* Tesselator */
  115.     GLU_BEGIN    = 100100,
  116.     GLU_VERTEX    = 100101,
  117.     GLU_END        = 100102,
  118.     GLU_ERROR    = 100103,
  119.     GLU_EDGE_FLAG    = 100104,
  120.  
  121.     /* Contour types */
  122.     GLU_CW        = 100120,
  123.     GLU_CCW        = 100121,
  124.     GLU_INTERIOR    = 100122,
  125.     GLU_EXTERIOR    = 100123,
  126.     GLU_UNKNOWN    = 100124,
  127.  
  128.     /* Tesselation errors */
  129.     GLU_TESS_ERROR1    = 100151,  /* missing gluEndPolygon */
  130.     GLU_TESS_ERROR2 = 100152,  /* missing gluBeginPolygon */
  131.     GLU_TESS_ERROR3 = 100153,  /* misoriented contour */
  132.     GLU_TESS_ERROR4 = 100154,  /* vertex/edge intersection */
  133.     GLU_TESS_ERROR5 = 100155,  /* misoriented or self-intersecting loops */
  134.     GLU_TESS_ERROR6 = 100156,  /* coincident vertices */
  135.     GLU_TESS_ERROR7 = 100157,  /* all vertices collinear */
  136.     GLU_TESS_ERROR8 = 100158,  /* intersecting edges */
  137.     GLU_TESS_ERROR9 = 100159,  /* not coplanar contours */
  138.  
  139.     /* NURBS */
  140.     GLU_AUTO_LOAD_MATRIX    = 100200,
  141.     GLU_CULLING        = 100201,
  142.     GLU_PARAMETRIC_TOLERANCE= 100202,
  143.     GLU_SAMPLING_TOLERANCE    = 100203,
  144.     GLU_DISPLAY_MODE    = 100204,
  145.     GLU_SAMPLING_METHOD    = 100205,
  146.     GLU_U_STEP        = 100206,
  147.     GLU_V_STEP        = 100207,
  148.  
  149.     GLU_PATH_LENGTH        = 100215,
  150.     GLU_PARAMETRIC_ERROR    = 100216,
  151.     GLU_DOMAIN_DISTANCE    = 100217,
  152.  
  153.     GLU_MAP1_TRIM_2        = 100210,
  154.     GLU_MAP1_TRIM_3        = 100211,
  155.  
  156.     GLU_OUTLINE_POLYGON    = 100240,
  157.     GLU_OUTLINE_PATCH    = 100241,
  158.  
  159.     GLU_NURBS_ERROR1  = 100251,   /* spline order un-supported */
  160.     GLU_NURBS_ERROR2  = 100252,   /* too few knots */
  161.     GLU_NURBS_ERROR3  = 100253,   /* valid knot range is empty */
  162.     GLU_NURBS_ERROR4  = 100254,   /* decreasing knot sequence */
  163.     GLU_NURBS_ERROR5  = 100255,   /* knot multiplicity > spline order */
  164.     GLU_NURBS_ERROR6  = 100256,   /* endcurve() must follow bgncurve() */
  165.     GLU_NURBS_ERROR7  = 100257,   /* bgncurve() must precede endcurve() */
  166.     GLU_NURBS_ERROR8  = 100258,   /* ctrlarray or knot vector is NULL */
  167.     GLU_NURBS_ERROR9  = 100259,   /* can't draw pwlcurves */
  168.     GLU_NURBS_ERROR10 = 100260,   /* missing gluNurbsCurve() */
  169.     GLU_NURBS_ERROR11 = 100261,   /* missing gluNurbsSurface() */
  170.     GLU_NURBS_ERROR12 = 100262,   /* endtrim() must precede endsurface() */
  171.     GLU_NURBS_ERROR13 = 100263,   /* bgnsurface() must precede endsurface() */
  172.     GLU_NURBS_ERROR14 = 100264,   /* curve of improper type passed as trim curve */
  173.     GLU_NURBS_ERROR15 = 100265,   /* bgnsurface() must precede bgntrim() */
  174.     GLU_NURBS_ERROR16 = 100266,   /* endtrim() must follow bgntrim() */
  175.     GLU_NURBS_ERROR17 = 100267,   /* bgntrim() must precede endtrim()*/
  176.     GLU_NURBS_ERROR18 = 100268,   /* invalid or missing trim curve*/
  177.     GLU_NURBS_ERROR19 = 100269,   /* bgntrim() must precede pwlcurve() */
  178.     GLU_NURBS_ERROR20 = 100270,   /* pwlcurve referenced twice*/
  179.     GLU_NURBS_ERROR21 = 100271,   /* pwlcurve and nurbscurve mixed */
  180.     GLU_NURBS_ERROR22 = 100272,   /* improper usage of trim data type */
  181.     GLU_NURBS_ERROR23 = 100273,   /* nurbscurve referenced twice */
  182.     GLU_NURBS_ERROR24 = 100274,   /* nurbscurve and pwlcurve mixed */
  183.     GLU_NURBS_ERROR25 = 100275,   /* nurbssurface referenced twice */
  184.     GLU_NURBS_ERROR26 = 100276,   /* invalid property */
  185.     GLU_NURBS_ERROR27 = 100277,   /* endsurface() must follow bgnsurface() */
  186.     GLU_NURBS_ERROR28 = 100278,   /* intersecting or misoriented trim curves */
  187.     GLU_NURBS_ERROR29 = 100279,   /* intersecting trim curves */
  188.     GLU_NURBS_ERROR30 = 100280,   /* UNUSED */
  189.     GLU_NURBS_ERROR31 = 100281,   /* unconnected trim curves */
  190.     GLU_NURBS_ERROR32 = 100282,   /* unknown knot error */
  191.     GLU_NURBS_ERROR33 = 100283,   /* negative vertex count encountered */
  192.     GLU_NURBS_ERROR34 = 100284,   /* negative byte-stride */
  193.     GLU_NURBS_ERROR35 = 100285,   /* unknown type descriptor */
  194.     GLU_NURBS_ERROR36 = 100286,   /* null control point reference */
  195.     GLU_NURBS_ERROR37 = 100287,   /* duplicate point on pwlcurve */
  196.  
  197.     /* Errors */
  198.     GLU_INVALID_ENUM        = 100900,
  199.     GLU_INVALID_VALUE        = 100901,
  200.     GLU_OUT_OF_MEMORY        = 100902,
  201.     GLU_INCOMPATIBLE_GL_VERSION    = 100903,
  202.  
  203.     /* New in GLU 1.1 */
  204.     GLU_VERSION    = 100800,
  205.     GLU_EXTENSIONS    = 100801
  206. };
  207.  
  208.  
  209. typedef struct GLUquadricObj GLUquadricObj;
  210.  
  211. typedef struct GLUtriangulatorObj GLUtriangulatorObj;
  212.  
  213. typedef struct GLUnurbsObj GLUnurbsObj;
  214.  
  215.  
  216.  
  217. /*
  218.  *
  219.  * Miscellaneous functions
  220.  *
  221.  */
  222.  
  223. extern void gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
  224.                GLdouble centerx, GLdouble centery, GLdouble centerz,
  225.                GLdouble upx, GLdouble upy, GLdouble upz );
  226.  
  227.  
  228. extern void gluOrtho2D( GLdouble left, GLdouble right,
  229.                 GLdouble bottom, GLdouble top );
  230.  
  231.  
  232. extern void gluPerspective( GLdouble fovy, GLdouble aspect,
  233.                 GLdouble zNear, GLdouble zFar );
  234.  
  235.  
  236. extern void gluPickMatrix( GLdouble x, GLdouble y,
  237.                GLdouble width, GLdouble height,
  238.                GLint viewport[4] );
  239.  
  240. extern int gluProject( GLdouble objx, GLdouble objy, GLdouble objz,
  241.                const GLdouble modelMatrix[16],
  242.                const GLdouble projMatrix[16],
  243.                const GLint viewport[4],
  244.                GLdouble *winx, GLdouble *winy, GLdouble *winz );
  245.  
  246. extern int gluUnProject( GLdouble winx, GLdouble winy, GLdouble winz,
  247.              const GLdouble modelMatrix[16],
  248.              const GLdouble projMatrix[16],
  249.              const GLint viewport[4],
  250.              GLdouble *objx, GLdouble *objy, GLdouble *objz );
  251.  
  252. extern const GLubyte* gluErrorString( GLenum errorCode );
  253.  
  254.  
  255.  
  256. /*
  257.  *
  258.  * Mipmapping and image scaling
  259.  *
  260.  */
  261.  
  262. extern int gluScaleImage( GLenum format,
  263.               GLint widthin, GLint heightin,
  264.               GLenum typein, const void *datain,
  265.               GLint widthout, GLint heightout,
  266.               GLenum typeout, void *dataout );
  267.  
  268. extern int gluBuild1DMipmaps( GLenum target, GLint components,
  269.                   GLint width, GLenum format,
  270.                   GLenum type, const void *data );
  271.  
  272. extern int gluBuild2DMipmaps( GLenum target, GLint components,
  273.                   GLint width, GLint height, GLenum format,
  274.                   GLenum type, const void *data );
  275.  
  276.  
  277.  
  278. /*
  279.  *
  280.  * Quadrics
  281.  *
  282.  */
  283.  
  284. extern GLUquadricObj *gluNewQuadric( void );
  285.  
  286. extern void gluDeleteQuadric( GLUquadricObj *state );
  287.  
  288. extern void gluQuadricDrawStyle( GLUquadricObj *quadObject,
  289.                  GLenum drawStyle );
  290.  
  291. extern void gluQuadricOrientation( GLUquadricObj *quadObject,
  292.                    GLenum orientation );
  293.  
  294. extern void gluQuadricNormals( GLUquadricObj *quadObject, GLenum normals );
  295.  
  296. extern void gluQuadricTexture( GLUquadricObj *quadObject,
  297.                    GLboolean textureCoords );
  298.  
  299. extern void gluQuadricCallback( GLUquadricObj *qobj,
  300.                     GLenum which, void (*fn)() );
  301.  
  302. extern void gluCylinder( GLUquadricObj *qobj,
  303.              GLdouble baseRadius,
  304.              GLdouble topRadius,
  305.              GLdouble height,
  306.              GLint slices, GLint stacks );
  307.  
  308. extern void gluSphere( GLUquadricObj *qobj,
  309.                GLdouble radius, GLint slices, GLint stacks );
  310.  
  311. extern void gluDisk( GLUquadricObj *qobj,
  312.              GLdouble innerRadius, GLdouble outerRadius,
  313.              GLint slices, GLint loops );
  314.  
  315. extern void gluPartialDisk( GLUquadricObj *qobj, GLdouble innerRadius,
  316.                 GLdouble outerRadius, GLint slices, GLint loops,
  317.                 GLdouble startAngle, GLdouble sweepAngle );
  318.  
  319.  
  320.  
  321. /*
  322.  *
  323.  * Nurbs
  324.  *
  325.  */
  326.  
  327. extern GLUnurbsObj *gluNewNurbsRenderer( void );
  328.  
  329. extern void gluDeleteNurbsRenderer( GLUnurbsObj *nobj );
  330.  
  331. extern void gluLoadSamplingMatrices( GLUnurbsObj *nobj,
  332.                      const GLfloat modelMatrix[16],
  333.                      const GLfloat projMatrix[16],
  334.                      const GLint viewport[4] );
  335.  
  336. extern void gluNurbsProperty( GLUnurbsObj *nobj, GLenum property,
  337.                   GLfloat value );
  338.  
  339. extern void gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property,
  340.                  GLfloat *value );
  341.  
  342. extern void gluBeginCurve( GLUnurbsObj *nobj );
  343.  
  344. extern void gluEndCurve( GLUnurbsObj * nobj );
  345.  
  346. extern void gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots, GLfloat *knot,
  347.                GLint stride, GLfloat *ctlarray, GLint order,
  348.                GLenum type );
  349.  
  350. extern void gluBeginSurface( GLUnurbsObj *nobj );
  351.  
  352. extern void gluEndSurface( GLUnurbsObj * nobj );
  353.  
  354. extern void gluNurbsSurface( GLUnurbsObj *nobj,
  355.                  GLint sknot_count, GLfloat *sknot,
  356.                  GLint tknot_count, GLfloat *tknot,
  357.                  GLint s_stride, GLint t_stride,
  358.                  GLfloat *ctlarray,
  359.                  GLint sorder, GLint torder,
  360.                          GLenum type );
  361.  
  362. extern void gluBeginTrim( GLUnurbsObj *nobj );
  363.  
  364. extern void gluEndTrim( GLUnurbsObj *nobj );
  365.  
  366. extern void gluPwlCurve( GLUnurbsObj *nobj, GLint count, GLfloat *array,
  367.              GLint stride, GLenum type );
  368.  
  369. extern void gluNurbsCallback( GLUnurbsObj *nobj, GLenum which, void (*fn)() );
  370.  
  371.  
  372.  
  373. /*
  374.  *
  375.  * Polygon tesselation
  376.  *
  377.  */
  378.  
  379. extern GLUtriangulatorObj* gluNewTess( void );
  380.  
  381. extern void gluTessCallback( GLUtriangulatorObj *tobj, GLenum which,
  382.                   void (*fn)() );
  383.  
  384. extern void gluDeleteTess( GLUtriangulatorObj *tobj );
  385.  
  386. extern void gluBeginPolygon( GLUtriangulatorObj *tobj );
  387.  
  388. extern void gluEndPolygon( GLUtriangulatorObj *tobj );
  389.  
  390. extern void gluNextContour( GLUtriangulatorObj *tobj, GLenum type );
  391.  
  392. extern void gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
  393.                void *data );
  394.  
  395.  
  396.  
  397. /*
  398.  *
  399.  * New functions in GLU 1.1
  400.  *
  401.  */
  402.  
  403. extern const GLubyte* gluGetString( GLenum name );
  404.  
  405.  
  406.  
  407. #ifdef __cplusplus
  408. }
  409. #endif
  410.  
  411.  
  412. #endif
  413.